home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8994 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.dfci.harvard.edu!gotd
  2. From: gotd@jimmy.harvard.edu (Godfrey Degamo)
  3. Newsgroups: comp.lang.c
  4. Subject: H&S <=> K&R
  5. Date: 7 Mar 1996 21:12:57 GMT
  6. Organization: Dana-Farber Cancer Institute
  7. Message-ID: <4hnjgp$brj@cisunix1.dfci.harvard.edu>
  8. NNTP-Posting-Host: occams.dfci.harvard.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Hello readers.
  12.  
  13. I have a really silly question/observation, which I'm hoping
  14. you can answer/verify.
  15.  
  16. First, my H&S 4th edition mentions nothing (I think) on
  17. fflush with argument NULL.  However, my ANSI K&R book clearly states
  18. that fflush( NULL) flushes all output stream.  My K&R book is
  19. copyright 1988, my H&S book is copyright 1995.  So, has this
  20. feature of ANSI C changed?  (Or am I just overlooking something?)
  21.  
  22.  
  23. Second, my K&R book clearly states that the scanf conversions,
  24. [...], and [^...] matches a *non-empty* string.  Whereas my H&S book
  25. does not.  (I don't think it implies it... but I'm not sure...)
  26.  
  27. Thus according to K&R the following will happen?
  28. char buf1[] = "blahblah:123212";
  29. char buf2[] = ":2313";
  30.  
  31.  
  32. sscanf( buf1, "%[^:]:%s", s1, s2);    /* OK in K&R and H&S */
  33. sscanf( buf2, "%[^:]:%s", s1, s2);    /* Error in K&R, but H&S?????? */
  34.  
  35.  
  36. Perhaps I'm reading both books wrong, in which case, I've made
  37. an ass out of myself!  Anyways, if you can clear up my confusion,
  38. that would be great.  Once again, sorry for my silly question,
  39. but thanks for your time.
  40.  
  41. -Godfrey Degamo,
  42.  gotd@jimmy.harvard.edu
  43.